package org.zht.dormpro.dorm.cacher.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.zht.dormpro.dorm.aop.annotation.GetCache;
import org.zht.dormpro.dorm.cacher.IMajorCacher;
import org.zht.dormpro.dorm.mapper.TbMajorMapper;
import org.zht.dormpro.dorm.model.TbMajor;
import org.zht.dormpro.dorm.service.IMajorService;
import org.zht.dormpro.pub.constant.CacheKey;

import java.util.List;

@Repository
public class MajorCacherImpl implements IMajorCacher {

    @Autowired
    private TbMajorMapper tbMajorMapper;
    @Override
    @GetCache(key = CacheKey.MAJOR_LIST_KEY,fieldKey = "#colId")
    public List<TbMajor> getMajorByCollegeId(String colId){
        List<TbMajor> majorByCollegeId = tbMajorMapper.getMajorByCollegeId(colId);
        return majorByCollegeId;
    }
}
